// Copyright (c) 2014, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

library git_fast_sha_test;

import 'dart:typed_data';

import 'package:crypto/crypto.dart' as crypto;
import 'package:unittest/unittest.dart';

import '../../lib/git/fast_sha.dart';

defineTests() {
  group('git.fast_sha', () {
    test('test 0', ()      => _test(0));
    test('test 1', ()      => _test(1));
    test('test 10', ()     => _test(10));
    test('test 100', ()    => _test(100));
    test('test 1000', ()   => _test(1000));
    test('test 10000', ()  => _test(10000));
    test('test 100000', () => _test(100000));

    // Tests from package:crypto.
    test('expected values', _testExpectedValues);
    test('invalid use', _testInvalidUse);
    test('repeated digest', _testRepeatedDigest);
    test('short inputs',
        () => _testStandardVectors(sha1_short_inputs, sha1_short_mds));
    // The long tests add 1MB to the compiled JS size.
    //test('long inputs',
    //    () => _testStandardVectors(sha1_long_inputs, sha1_long_mds));
  });
}

void _test(int size) {
  List data = _createData(size);

  FastSha sha = new FastSha();
  sha.add(data);
  List<int> fastShaResult = sha.close();

  crypto.SHA1 sha1 = new crypto.SHA1();
  sha1.add(data);
  List<int> cryptoResult = sha1.close();

  expect(fastShaResult, cryptoResult);
}

List _createData(int size) {
  Uint8List data = new Uint8List(size);
  for (int i = data.length - 1; i >= 0; i--) {
    data[i] = ((i * i) ^ i) & 0xFF;
  }
  return data;
}

// test code from package:crypto

void _testExpectedValues() {
  var expectedValues = const [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "5ba93c9db0cff93f52b521d7420e43f6eda2784f",
    "3f29546453678b855931c174a97d6c0894b8f546",
    "0c7a623fd2bbc05b06423be359e4021d36e721ad",
    "a02a05b025b928c039cf1ae7e8ee04e7c190c0db",
    "1cf251472d59f8fadeb3ab258e90999d8491be19",
    "868460d98d09d8bbb93d7b6cdd15cc7fbec676b9",
    "6dc86f11b8cdbe879bf8ba3832499c2f93c729ba",
    "67423ebfa8454f19ac6f4686d6c0dc731a3ddd6b",
    "63bf60c7105a07a2b125bbf89e61abdabc6978c2",
    "494179714a6cd627239dfededf2de9ef994caf03",
    "2c7e7c384f7829694282b1e3a6216def8082d055",
    "cff9611cb9aa422a16d9beee3a75319ce5395912",
    "e51f9799c4a21bba255cf473baf95a89e1b86180",
    "f741644ba6e1bcf5fee6d3c1b6177b78468ece99",
    "fb1d9241f67827ce6dd7ac55f1e3c4e4f50caa03",
    "56178b86a57fac22899a9964185c2cc96e7da589",
    "0a0315ec7b1e22a79fc862edf79bda2fc01669e3",
    "32af8a619c2566222bb0ba0689dabcc480c381d5",
    "d35b5afbc48a696897c084e6e71aae67c7cd9417",
    "602c63d2f3d13ca3206cdf204cde24e7d8f4266c",
    "a3c6fbe5c13e8b41fadc204c0cf26f3f214189f4",
    "25e480e9e0ca2b610105cd1424b8a35f63fb3981",
    "45412d51d3ca7bcf452d1612720ee88f9d2427c3",
    "ed6a95036e3e046931597a457db7a78b7309c4c0",
    "b4fe0256d346700783420e08a4a6f7992b1e36c9",
    "33e1799e98280e5a9ace5509477a2048607c5537",
    "cf193837f6de43f8e38000acfcf764fa8d8fde22",
    "7c8de247dda83599af2ec2ee2d29e20583dac34b",
    "f38a076f70613fc251c4d21e6435ad08341a8a99",
    "dcd68e6174bd74ba180da047a7345e8d111f85fd",
    "43bbacb5f62a0482cbdb564171b04365ca6e27c0",
    "ae5bd8efea5322c4d9986d06680a781392f9a642",
    "eb90bce364635c4c23b49f493f0043579bc85c17",
    "2942c7afa65444c43d0592d0dc73ca71db729205",
    "abf726f5fda729fb7f3f0484d7c94b3107aa02ae",
    "75db4f6bcc05a781dda9d17c46717286dd53654b",
    "a82cb42d89daf5fbc1d4a48476229c495782f98d",
    "fc1a69683744af823cd69e8a1e3f460591714028",
    "dc68db44b48521b0700a864896a00e17777aea83",
    "cc9ad99e917042381b0f99588896cbf236aa8ed3",
    "ec7a68484a749c7065c6b746f9c465dcb414f370",
    "c627c449deff14ae7ed807293d30846f061da5b8",
    "4782f2a19b6dbb0882d656de86c3d21a7317f768",
    "02d4eed99e7307bea39af5330bf7fb388d48b496",
    "b3d99b9d90a69e50fd4365704f5ab2eab7bc9763",
    "9b1c07176bb227f73e8a4e173071d39302061de2",
    "d79097ddac552a6e02a52ce7aaf494d2d73b2557",
    "df7f23b160e75b9bae5ea1e62b43a5a34a260127",
    "f598f3780d8c374d97957b9b62d56106e9e0b2d2",
    "0bd98598f9ab29c1359ef5460a206dd1370515e3",
    "e6c320834f69d81689e1ecd5abc808d49d9c4e07",
    "fd5ee7588cd129e12b886974621fd29facc78e19",
    "2a9c28ef61eb536d3bbda64ad95a132554be3d6b",
    "cfae6d86a767b9c700b5081a54265fb2fe0f6fd9",
    "8ae2d46729cfe68ff927af5eec9c7d1b66d65ac2",
    "636e2ec698dac903498e648bd2f3af641d3c88cb",
    "7cb1330f35244b57437539253304ea78a6b7c443",
    "2e780486f64bc91fbfa2785ec1ca5c9e3cc07939",
    "4a7713d44e97d9f09ae1d786199c58ae2bfaf3eb",
    "c98714b16f92c8a770e9fc229df834d1688e282f",
    "aace3dd6f54a2a255aba920f5ffc8cf04b85a69a",
    "cf8563896a3b0a0775985d8289444c4bbc478da7",
    "6d942da0c4392b123528f2905c713a3ce28364bd",
    "c6138d514ffa2135bfce0ed0b8fac65669917ec7",
    "69bd728ad6e13cd76ff19751fde427b00e395746",
    "ce705b7c60d46e7e36fe073db8822698579ca410",
    "c717ebbf6a2bf1bb33da6257352d5085bee218b3",
    "86151d140aafc9a4b5877d3fbb49014fe5906e57",
    "7446b5a6bbcc58bc9662451a0a747d7d031f9a7d",
    "c24887924f92adac5ae367995d12691c662b7362",
    "5af83cfd42d61967778889ca911cfb6c14339ba7",
    "587d4f6e6b4e21343423e434679009cbd3d24dcf",
    "ac65dd946c5cc432d4d624caeb53c7363f96b7af",
    "fa71e70750674c0f6b4aa19d0be717b2936c83fd",
    "c9efe6dd0a019315f73f3962de38b6c848a1705b",
    "d1d05649b952c8f6eb016be08fe1544aac5d5925",
    "cc3081ac1d695bae51cfd5b44b9fb3a230733cc3",
    "eb9de332558953792687d9a7f598b5d84bf0a46b",
    "39de5efdc92e3d3678f24d2cf545ba4d172d003d",
    "399dbc9f721e44a992a0def42d999b32af449adc",
    "996a2817c8acbc667e1c4c27b8f4e9952736dd7a",
    "3ef8189ce1bcc0d65aa182b1a81534635edfdf2b",
    "d676714c6a6ff4e17a60c0511c25aa8b164fa606",
    "4db6e3381e1b9290267c1539e1053793c8b81fa1",
    "3a34d35b0296fe4d83eda39b742a9d8f4b13a958",
    "54f3b45304ef1287f54b877fcce3285e154f9d6c",
    "b1ea96216e025377ab5aa845238fc8bc65dd60e1",
    "bc6c7488145485dede1ae1d43b594f0046bcda0f",
    "3d9a0619ecf88c84ce86213e9aa91d9a252cbc32",
    "92ccaa0b4ce89e2bd80a61b9bafd5ac58ab7b588",
    "3eb326b5bf4440fb3a88e3dcb05c1db5ea01ac5c",
    "989c63e819b13d4cadfb33f8deafbc57c1992a12",
    "ae944552c20cf16f07a5c357713832c9d72d0c6b",
    "46723e982569a1e2d9edced5498fc1f46f7d63fc",
    "3bc5dae7907c83a0693f87fd8372efdd1df53e09",
    "96d281ba44eb21ecfb1663c8ac5752c48686a927",
    "fa0ef18178880a72b51c26555c10f5210dab4390",
    "0c7ecac32b8ed6d9835d381bf069568722a276e1",
    "649e44ecba85c0938ec09229cee4bb69388ec642",
    "1e6634bfaebc0348298105923d0f26e47aa33ff5",
    "af2af2734bb2baa288940cb62109f4849daa347f",
    "22d14bc045cc9a3794c99beee7abe278bf24d6d8",
    "c3164ccbed75b82ed3f59f4a47fe09b256025549",
    "c27b5bc7cd24de4913614a769a442e9cc9fb0e08",
    "f44d48d98cac77522ff6b9e1b9cbb8489e58e588",
    "ea19a71ffbec9572f6cd65523acaf865ec05ab52",
    "cda0eb9d310247bd1e8b3ea10d9b9deff6fbaba9",
    "449dfce971b9d65d69fbc72940e9a885e8dde9ce",
    "96eebb6b95a9da99c58190cbd77cd6fbcf638a79",
    "670f7a869e90ce86e0a18232a9d4b1f97c1c77d0",
    "bc544e24573d592290fdaff8ecf3f7f2b00cd483",
    "e4ce142d09a84a8645338dd6535cbfaaf800d320",
    "1c26461e26eb697ccc36a98714ee70caaa87a84e",
    "51c5b1c25a71ff00394a84ab48b5733c8955551e",
    "84803504181c0ae33a511c49af5015a5b1892bfd",
    "7cc8bca120c2635abfea82dd203112b5c7e165da",
    "44e2519a529d7261f1bebedc8ed95e1182cae0dc",
    "2a81372da39c1df4251539a9922717b7cf5f0334",
    "41c89d06001bab4ab78736b44efe7ce18ce6ae08",
    "d3dbd653bd8597b7475321b60a36891278e6a04a",
    "3723f8ab857804f89f80970e9fc88cf8f890adc2",
    "d031c9fb7af0a461241e539e10db62ed28f7033b",
    "e0b550438e794b65d89b9ee5c8f836ae737decf0",
    "fb3998281c31d1a8eea2ea737affd0b4d6ab6ac2",
    "7a914d8b86a534581aa71ec61912ba3f5b478698",
    "a271f71547442dea7b2edf65cd5fbd5c751710aa",
    "89d7312a903f65cd2b3e34a975e55dbea9033353",
    "e6434bc401f98603d7eda504790c98c67385d535",
    "3352e41cc30b40ae80108970492b21014049e625",
    "6981ed7d97ffca517d531cd3d1874b43e11f1b46",
    "76382259107c56b3f798107a8acc62b32d8ec2c6",
    "548538582fd2e877b023be0611150df9e7ca99e8",
    "54152ac7d9f4e686e47d3a74d96229c33793d51b",
    "40e1b424cb6f13453ea005d077adb732b2fb9084",
    "a47fd7470c43f7cb7e5dd4159fb0c11644f6a108",
    "4ab5a4f084d4d95894078e8d570eb0bff13c6286",
    "5f9de1b34863866e2c644fee51ec0bed7d6b7d91",
    "2425097e0fea366d916d919f690e99cb6594d370",
    "1e2cf1d35240f0b37d056c69c18ab95559e311d8",
    "25fb08a7408a380b19074fa547f4fc4eb7d303b9",
    "e38c3774d31cd2ab4079c38abd7876fe1ff8c1cb",
    "e06dfc04b000d187b8bd6b539c884581e49a7b48",
    "027f9a54264ed75254e00c6a8f821630d780c6b3",
    "a86906b83ee8851520e2e628ab6295ce3497a2d3",
    "3ba5b1a7c92cf4e749995b819cea8c37e479f433",
    "e192f0d9326d7a0406b343d89e6c1b0bd1bbfb76",
    "e5c31d8a5d94c54aba514694cb0ddcd835b328de",
    "77237ee62b7ea8504451b6372289bba5d46d15a1",
    "11e85e204f22d0784746ffdcf8c5bc0b5de6a211",
    "6a2bc12e4605f27fce8c2e90a387e7dee901e48f",
    "8c696b02e3bd3f7fb02ff852ee8bf8d1d3c9c75c",
    "75a73cd24385a1e1768adddb23b3d7183cbb2f00",
    "3c1a0181f2b5d470bf78df6dd596d85f63e4d855",
    "0be0dc00e59482a360f21199abe9974a85047da2",
    "b853306aa29ebbea560c61eb1f9a2f740b45b6c8",
    "5e477b0a9dfe6225bdab510bd87bcecc59bc2497",
    "9112798181ba4cc1c528a70729cf784115ca69f6",
    "d741bec70d9070cee9960c5043a2773051e4cbaa",
    "7135cdf89a331ca5cf339d414a950afa9e2bd786",
    "aca27247604a6960e513b1eea56146bb4e443c47",
    "cee02aef5cb718ab5838c9673deb86f47f479f68",
    "cd024743ff967bf59d595461f549efe50ae155f6",
    "c100aaa2cc196af36fcdc403e99f04f357c88131",
    "2f33512a40135a515b68bf53b09844678c7548a1",
    "3416bd9a3f79dbc063fff2c25bbd760831bf49cb",
    "679256809caa8eb74c086b8c3a0e2d4abf850f86",
    "476d4a88a9dabdf50e65dfb207b7117ff9d6e2f4",
    "9af88ed103f83fab906e5851728b4d47c31cc5cf",
    "c0733dd1c6ff8f9b1463c3e3ddd299cd3f81d8f0",
    "5b19b45105657e67a75d290e52b0b12b7cb54fb5",
    "aa6cc574968f08a0a975fbc65ae1c673125a38b6",
    "1b3e6fa3c2a28bec0d42f4db58190bd393d372d4",
    "97019771490e12f6b89b581c7df82ec1e250652b",
    "37452dde0527a88d2beb55b5b98eebeceaa2b464",
    "5ada134688493c8ff0298563b6d37e0c2b820818",
    "27c194fd8566a2c5eff8d00a9ad2febf8105846e",
    "b692e7fdf82422566df39942a262647fc27544db",
    "a8df45ea509a4abbb0a9ed2af668040ab420ccca",
    "b9aa0fd55e3da81095d899e52d6427406779e6c7",
    "e308d9ea4b329e5ce3ae1ca31cdfc59b687cb7a7",
    "7366daa91f296da16fc931b8d820c671674c73b1",
    "b44ab5276973cfccf3b6e1b50f78d1dccae35e0b",
    "48a9d63f99faea8f26c8f9b37ae8650419767808",
    "356301d2c18c60cbf761e8820e78b2670a54ba83",
    "c82f43012f075b3be2018878d30ba404ccde3b5d",
    "b3d1e00b9f264ff969f7a16c6ae3901f9edb933e",
    "0446503bbb165ad4e747ebe9e040a550cf6ea1c4",
    "f4e0b1d08f68e38c83604fda8266535965955131",
    "38dfba530b2a3b77c25816472c44c03b7e32fe9d",
    "f079c4078b90472d5a6de034133e6fb6bbb16745",
    "453e806d74a27e554f2a3395ce7917919bf3bde6",
    "995b6f0c8f9eda20f3e5a2bd89df908747900008",
    "c7b4dbb98c78008fd53159174b7baadf250fa5a9",
    "2407f4de74bc711d0071476eccd73370bb6fbd0e",
    "56b81cf38a7ad1eb515a8e21af35b308f4977cfe",
    "de45d743c21cbe75d718086178ce454ced1dfa1a",
    "9dcc4b7304e7305639ff55e78bf538e6e4bdc847",
    "63cdae0a07072e387cdbcac4f73bfb0ed66432f6",
    "20431c9fd7ed84d31937901e6c2f2263e22f2915",
    "54d11e99127d159799dbce10f51a75e697780478",
    "b9ae613785fc3061f9df6a4f1e86e6252a6004b3",
    "366ab5426763b78563de648d831e6e8f02e16c4a",
    "b5a7a52b733421f97a37319fe3580a4ba2b86a11",
    "8ed72f03309e7ab31964e4dbfb25e8ab41684124",
    "5afd9a289b4fce41efb7a77a2baa9314f9f11cf5",
    "21d0451e21cae775b5f718886fd59b2ea9e9e787",
    "696cd0f2c8a6e0fce77fac490b70621a71c51e38",
    "5bcd7ae76d23e39340ef0a0f2fd38ddaa3b4b733",
    "0e68e78d5d668479992fd6a7ea2879f1c0b44403",
    "f93dbecda2f86c5c52936e986a582680bcc10953",
    "e9ef3322618fd7db744b674620bac1d2427c79e5",
    "2febe02de9105bf3ee4412c79c7c3df1044037ed",
    "4f60bb9f2c379b6c6b95003d54a4b4dae47889e8",
    "f2ce6d9c33c6dea70d4a6955f4d00fa8371e54d4",
    "c012e1bbaac2cb4b7074a859bb98e469177e1afd",
    "7c5c4cb81d270a5a41f7a41e6124e6028070ee97",
    "669702442cabc5b51604234fd8ef37062a6cf11a",
    "0b5febebdc3f4f31d6c5c52b83ef2a06c262ef8b",
    "cf5d815b01a6a3952ff81a688341222dcbb853fe",
    "845c71d2b20913850ef1fcfec5606412256639ab",
    "861c969227f1043620c9833c2580e64bf4cf52d5",
    "55241a343ca97a602f7a6c71183fe8976999651f",
    "1d298771d3d6c35899c5604660c1f6c77d1e71c1",
    "580cc8968318c3bf61ce62aa2ded2b15777de522",
    "65bb4da1216214d7962733a372e78966bdfda5d5",
    "17565818c45a669aa6bdd25a7c5c121120704731",
    "1ad5f3869d8b92fdc30b81b06e21b9be866e103f",
    "9b181c583aa16426c200931bfe5d4e6c269e6ca2",
    "60c456ecebd7834f3fa8d1f4307449bf41616740",
    "bd4c73a0a8748c627879652fad3761fd7ac36c4c",
    "0baa214b983e58e39ecec9bf2bd537a10b2071ad",
    "642c7c6166e4dd09183e1b32dfa62f6f3dfc8ad7",
    "9beb03f7c76da0de2bf22a08efd1e2bf07274f0d",
    "a0d8782e1eeccc7bb104a4c38f79f8541383fb1d",
    "1c1b52a04ac3aa838a3698395aa3d934784b4b50",
    "b844b4f08c5255fa66158fa18ad57154af1aa840",
    "c07f9c996bf7327dfb47c82eb6b8bda1af065e2f",
    "1b9fbff4d5a61741c90b6f040eac211285294510",
    "2e4766b0ebf480a027ae6f9e59e7a2ef9e2aef2a",
    "f7b8e5e76e6b4cb3dfa7af7070d5560400822b65",
    "54717f94e8f3ded40b4cc1a470eacb25cb10136f",
    "e2fce1365029e7d2e8c81f5b1f6c533629ef3752",
    "7d7bd28f79bfba1b69dcb45f81a423d1730b56d8",
    "1a17d4c4c689817bc9e5dce38ef79ea684eb8976",
    "1250a5f131121f1fc0aa77d3d6dfd641526f266a",
    "43c87ab4ed185c57ab3ccd9d89017897a4e77504",
    "5a7d9a1c26ef0cb99fa2d7e970b19ccf5a5e4229",
    "431e10ef7681217c353a54302c611661f5d8aa75",
    "c572caf20d5aa8b6a8faf99f6628594fe3ddf81b",
    "a1219d23a9efaaede86c392888a18f995b15e8e2",
    "be9a388016c3973d9b4a8d0c2c7fb9a6d254370e",
    "bb260e71e8bd5ed2baf5d9038600032669086ce3",
    "10fdd35f361b080323b86b47c893cfb13879c028",
    "154c3aed514692dfef86d89cf1dfbc4f8f1bfc92",
    "fa2c27c443e60a0bcd8a1eb82d20fec20759c03e",
    "4916d6bdb7f78e6803698cab32d1586ea457dfc8",
    "89d6d7a79dfc4c2588e5ba3726d163faa67c4249",
    "4bc7dfa199db2cc10d6fa1acbe2bea402c3f69f3",
    "ec485bc69fb3660cdd7c650a8da191c958273534",
    "1fb3afbdcd58e4edcd92c49f22d4caa0581749a1",
    "0183c0e82beb55c6b2bc24b89df5dd64b87d22d8",
    "d8dc481dbe69b312789e85b0284c114108a18bac",
    "296f1f75500286b9b4e5ac80fba1ea8452d40792",
    "205c3b9ed40f9f92a70e5920b85707f50689a618",
    "77ce91d45055ca41c52fa6f9a9c3117b2aee9611",
    "fe4c72354229cb1b9c9a05dde2ffa93ff6d12400",
    "48174534cef0fc3fec5b1a6dadfba2281c4195bd",
    "202413d6ea5edda76cd27e81f8700d0b379ef58e",
    "699b731a830041cc7afc2a0e8f48df1146abb75d",
    "3a5f338bf04229f9e45e1402988bd5c59dda930f",
    "8c620f2651c8ad1a40f4aa2fc0687848c6db1d75",
    "743fa8d2c15ddaa8923904ba6c2f61db15f5c71e",
    "ee065a446ffac9e405bc0e30b8a595d898fd8f57",
    "ba83d7ae664cde7a19ec33e839fa19b46beb7ee8",
    "0941612acd729027440f6aeac58ac28e18a44cda",
    "b4a3e1dab651d8e978abfa4c05c0cab1a33902f2",
    "30666bf53a5fed4b7d6bdbc993348e56144bb1b1",
    "f6a97e96436d9c5340009a497ba298d2901eb06d",
    "dc0b98a0d1d20b974885aac995d8c484d6594d4d",
    "62b3e62ba7f7194fed07c518179d0d86e4e20661",
    "699b84e119bffbbffa1a228e92682f1f394cabcd",
    "31ea9a067b4d9207bf4f4e4dbe3ce191cc754e05",
    "5b9ab97c102fcfb39efda8b788a4a387f18a507f",
    "a2f9fde34879a9e7f8caa9a21c2f2a4b47c24ede",
    "4201b2664b010fa180ec54c37d8615b3055f8a81",
    "84404983f08452a5ff4802e2f531602520d74546",
    "cc0ea7cd6b40fa790570fc767b363d1482718cb2",
    "0b0c30ce8a0770ee6a989e94bcf875494ed105d8",
    "6f5f7e81f4102d4f76c2604d9a0f028e49c4952e",
    "bab4994f3923af37ddbf54a1b69d5954852d1754",
    "2c2a9d56d09c676a7b6500d3ee18b6e100cbd87f",
    "58391cd702c86eec62fcfc9fbfff535410dfb150",
    "e3510479f43a21b29fde3504af668d37bdbbb799",
    "ac2369f558f15f080f68cd384fbe52f348a47e31",
    "e090b0bf8c1b9e7607962a8523f02d82e8cc12af",
    "262b8f0734bd8af3b42f21fefc9293a6c0bcf8d0",
    "a4f2c68beca4ab5b4b3db1ae9d07cd1b35f9fffd",
    "2ca39733f7a738c1fa8f515ffe2ff3ddc0c95c56",
    "63d16097c9b701d65b33700e05512bc905b58443",
    "bf77ecf143ceb21f1676c34b8d89c8bb3c43cc4e",
    "862e4228ab561c475192bdbd03bb33c743fc0734",
    "515e46b8fd51d614ca183cc8b3a076a9dbe3b70b",
    "15cd4acbc372d214f88c908c92903c7acb958e32",
    "26110861010beaef40f4590c701c0ff493f0ee27",
    "bf7e80ffa9cbda63f72be2b83d732730cb953e97",
    "d0900aeb1174173f7cc69d4788a61a574893d3b7",
    "e79a9ff141c1279cec57f7ea34d4ac4d057f0834",
    "a669f82976ca034e631533ce96e94b44e24dd2d8",
    "7aab0fd3799c01adc27018aebca9b3a0e1a3d7fc",
    "36248be03e0562a5306b30fcf7c4a4905cc41714",
    "6bf234d718fd1f27bbfbff81fb7fd64a22ae6745",
    "935ca3dfc9bfb1a3dccd5f794ab17e387441a4d2",
    "bb6ac0036ee0a56803045317744d4269ecfd0e62",
    "901406bf18a77ea00d526753957cb7423ee20b4e",
    "b0fe8f32582fa72bddd26dd9599c8205117c6789",
    "7d62100f74e829f7c5dd4db5817c530f3506813a",
    "713b4f3bb5a983590b7cb3d8b68aa56abb396cd9",
    "8e62281add5a87ba1b6df012b5fa25c7ec697265",
    "ebaa706a4823c278319dfcae0cb4a042d13eb39c",
    "c2e1fc39b890ff2b27ba8d0d355ef5704d792a8c",
    "eefbfce3c1c225bb429d0f5bc2552210373aa2d9",
    "4daea7d3291cdfb5bb13d522966c49bf1d692eac",
    "efd657e983cc85ba14c91f33fa81cb55413fbda9",
    "d33bce8f11c9f73666ae05446e0645235b29faf5",
    "c0c549f0976e53d790ea9fd14aedf0a0cb86a678",
    "44992a04e41a5cdb18833afe21a731c2b424b990",
    "6233b62e68349b3b17ffd9eaa7395b8521e31d38",
    "85d7f914b07ea2df148d5b1ed22f44928fce3a2a",
    "a2a0b0917c454ba4cb1ee2c61dda863004542ed1",
    "2411673903f84144bc5ee990f1b9160796196f1b",
    "6ee6dd69ff465b3bbd0c72048df09f001958419e",
    "c4493400da60de7e324dd0328ca5e3429d273c14",
    "a9ea2b10ea549303f8a5448f3921449ce25b8c36",
    "89725b40e71e1c0b27a68378a9e0ee0b2b0953b8",
    "cab92400df0b6b54e05d22b6ede2a2e5a623714e",
    "615653835fa024decf05ab5051fcabb4c6ecf853",
    "dccbb727546f111a22dbfe140aeb1ca04d74195c",
    "5d70ca252c600d686da9dd797018545aef3be66a",
    "a4b6a68e3b0e76d9d97b1323f8ebf752ab8b9815",
    "9fca700f9b8eb2159fade3e194a26a203270da3c",
    "69f3f034ffbe3f8881c47e96d8a3c25d108b0b39",
    "ccecfaa2c49a05caecd260b67e06b3db579aa0c8",
    "fc97a9f84b147b2244a9c68ed6e42a2b443102e9",
    "d64305c4b5c334fe9777f4a4c0c82389b289ff1e",
    "bc04cd94abdf3c177c38572e0b070cfdc6bb615d",
    "a96053be94fe5646d44c8455783180d5ad7d2ee8",
    "d34c409ea103ec1a7d54336149f33f3688fafff8",
    "660e49f0c60c8040ebfea6fbf9d4641bd29a50de",
    "2f8a580637446865145b7bc1f1376e5827966b47",
    "bca314aa8344c273ce31d86d05899c4dae043bc6",
    "c56453208571fd9c5ecb07451ef0f3b93e057ad8",
    "a238597192afa484d5c085938fe7e5ff5676c5e0",
    "7c033b565ec87dd7355c42a1822f4478db8a5a06",
    "2b0006ff2c586663fa9e60f0086ed31cbe263ae4",
    "07497ffe076d1c6ab3115f8762959763d03a661d",
    "5b886da6ce74d2392e79fbdf6573d37bd027e767",
    "946aa1664ebf30f0c8a5297d0307130943516e8a",
    "1fd32848d34600ec3dbec573897f6491f351e899",
    "caaf2320f61e4902e0a76275eade0b7b696df011",
    "188cf111bf5fac85bbd1234a725ae6d60c01b0be",
    "5a4b75efd596c4b63b585de8bdd7ba32e5c9d51f",
    "e6cde00bb218398b0746731df063d3bb566de2fa",
    "5eccce82721de36778dc60bc2202eba25330ac6c",
    "3f09e72b246a37847815cf6961c046fbe03a1b82",
    "e41218b9952ed1fdf1c13f4764ce0464ab84da09",
    "658e0bf69909da7ed06d0812743ea447f031ce20",
    "351df1eb81e4c608b0f3ab639b4535176417a65e",
    "8b1418a8864f2bed6f0a744d2a9bff79ce6e128c",
    "61300adab058879efab23bec70c679a8764cd61c",
    "c111d79fe3c572e5bb7b76665801304054f9460b",
    "dbd3d71d83e8eb20ee962d516bc649cf7611bafc",
    "3fd30a37347451c25842c635700d543a87159ec3",
    "cdab33892deced0454e1918813b95444c008ad49",
    "3e2e8c970e959b224f2333e4a9009b482e6863ea",
    "db4a493a3da552ed75be5fe0d96f6e99e2fd8eeb",
    "8b94a2c478e153ac9f5fc0b5de763b5124a1f70d",
    "465059936302a4b0f5303dee926a54c983701c2f",
    "4d2564abccc82edc1201f2f53975216586966c50",
    "0b0aa6cf662dcd77e54d3ad8f4f3dc5cc27151a2",
    "7918795cb32586b1e9e1024318e7eafa9b6ad18f",
    "35b1bc29234467f581fdcd1eab41d4f5b4e12b64",
    "abb9f092576cc104c714c930fc45ce4d64579119",
    "4b21a2a5f59effb24c569761e6d81190178b4ada",
    "69905ce9887ec25bba3431c58bc461cc198e216e",
    "9550962ede872cdba5c76e4edd01e0af82627131",
    "ba961c3cf1019b3ae55cf3cb4dfd63e56445a491",
    "1daa88cc7b906174701a12cd4ee99db16f0ce895",
    "1331b7f53c41c3af02675cf9bf9c90f766b15a66",
    "4c79f5e36122bdd75f0441394e17c47d1610398e",
    "47ca89f45df07b0cf76413b3e9501a673afaae92",
    "aafd8ad6f2e4fc8a62a62f9aa0e4b7dfe3ced4ac",
    "931dc6deca5a7bf14c7f09363b0128e7c2ed54c1",
    "2860821a19639a36f466d9b609c18d8b925a17be",
    "1b0833981cb628ba449413cf3b2298a2704aeb32",
    "36e77b3b717a5157e12ec0c31e97cd7206da5fa2",
    "de62d25749bd635d6bbe90c450277784a3c61cd0",
    "dc060bc4abac7f859ce49196440be380973875ec",
    "7f14938a411d1d43a518f616b89987754587e0a4",
    "d213475a442062ca792da0365b65013b91bce3e1",
    "568197b973327d6e1381fb787defb016554ff697",
    "0f487f25e2c6d326d5842469151decd377808c31",
    "944c6549c461c86e6efbb055ce984ce8cb477a3e",
    "5ab47b9585d9fb2479153f5ddb34df05d0d92d2b",
    "436104ec60d00a3d56f2715f4737b7a12141147f",
    "c4a4e308300110262019dbbfb4e3d8ba25b15596",
    "bc32be2415c6c9f7166cd72244aaebdb683ebc58",
    "283d86c470fead74c4bf994cba027f7edf596747",
    "7f387b0c27f3b2b273f85eaa35a93bf9d06d8a10",
    "92aace99c76e474bb8adcba0a875b477fc360885",
    "bb1cd0c8e0513222e530aa4e1f276cd3b13372ab",
    "b837ddcbc1eb7084f3c28b6e05bcdb3fea844b56",
    "d9a19e686d6c77640b10823a49e51b4eb8f51ee5",
    "198d0a35c25c67b817f4851f5ce0d0056259fdc3",
    "b5e6beb43c52ae185e2599db1927db7744335adc",
    "761dc03843153110601ae87b6e36dc29ace16ef6",
    "a64e92f4a324ad3ba3a116d561bd89036bc9eb71",
    "18dc53328d39feb8cd31c172e1695093ceec915e",
    "ae6082492d71f0ef80b402858803602ca3458153",
    "ec6f78c1620e0bda60f630f36015226ac8639b25",
    "c05239ff738a997fadd46525bf739e3e2c040e89",
    "707e83ce4291c118051c5191e888c283b4e98399",
    "cc14800d9ac3ef0c1f6731c9e70c7939c8dd0870",
    "c5294dbe82ede53a2d8bb0418503a2deba2e4f3b",
    "0455262dbd4b71218ed20f4162bbd0c3b7de4d07",
    "6ccb4f7070d3c908830645cd552e3d6112d059c4",
    "3974fab667fb7d746d5f088c6e277bfeee8128e7",
    "065742e2a66d88b5652b2e40d46c4d50102f6db3",
    "07fa47c9f269b323557182c61f6f6ed1c16ccafb",
    "196987fbf33148ae33ce9f9733a97ea845cdc1c4",
    "8139864a57098a32915f0e3aa6c0322fa9459fb6",
    "1fcbf41589c8e7d92274e64ae6ed3ad9016c179d",
    "055a0c549e6f648794cc65bddc08cfefffccdf9b",
    "f956af32d67df97f6534357de15b216cc2d2d102",
    "d7fea5323eea433ddb6277228ec0a5bc1ab4a808",
    "083c9487c4469fda257aa45c8876ec8269aeebd8",
    "9e88e459135e5f0b52ef6c371cca04a39d54b90b",
    "b8c1ee8246d14bd62e5a03b94b848b534613e7d2",
    "d26b97682f8acb1daf78be8c4418a0ebb17a05b4",
    "68f2b5a79ddb450cd1b4d5d6e502979c9f157996",
    "629e969018aa82b56389a3e601ef2a209f07cf07",
    "2dca01e39393889210c566779afb65048a387785",
    "d51c2f00f8c0fa2484497abe1bf85689c45d42ae",
    "467dd26d49785595bba3d406de25f5df8fd8fd4f",
    "72f9f715ea0aaf529be15e6afd7388e02341af75",
    "25a5435435d5020c5a7cbbb84d3f9b5e8b2fb9fe",
    "059d91ec492b6051340704b240b282d1fbe3d114",
    "33fd244ba8454d234e7d6a8d04a55b78eff890c5",
    "7d008c2d8d47bb97fc5dfe3de4559506e7fc4708",
    "860ddab2982e9dac6cdd1e19f5c6c53dab82e4c1",
    "4e39274189149868840fe7832230aa66483cd72d",
    "c61b506b45d98fe6ce5422f8edf6f8bde43fd2df",
    "97a8be86139d2732a9009525dff7cf77781acec1",
    "1e83aad8918c5002eca3b07b071045d23a7213f1",
    "d58d9ff6d19bd47651f3e2c766f869e6e07776ff",
    "edbb172dc2004b81bf3937a0d3e54ea5ed642da1",
    "1b144f648322f58caea9d31b3daf5ed686a3305b",
    "0662edf0d072a4efcbb94fc855a35b0631007eff",
    "446da0ba13c0c8cdec5dcb55beaff62f83822af7",
    "3ecdc37d6ba572f691cf42654b182ce0cf4853e0",
    "b9cf503328fc20919109b57a7785dbb664b2710e",
    "8519d7c98bc7b7610ee96c047fb71ba73a441ca4",
    "897e381dc5bac1eb7e8756dde6adae3ef2a081b8",
    "8d1f32ea054e1d02370eb02c8ddd67bafd4138b2",
    "d08fbd377a7f3689f881049f8c999e8c3616bdd2",
    "ef9c6777079358192b922616871f6e6762d5a05a",
    "63e2d52b6704f4660c1b6662a67acf385b4fb3cf",
    "9fd8b020a14f2dd4be4ad5de13352ab8addbedaa",
    "4481cc23334be067c5dfe87bffed1a1557fb5f64",
    "dbb3e3d67acf2807afce8e9cdc3f670b1cfb67c2",
    "0ab84832b324391f111b796e18dbdbf2c640f89f",
    "742672e86dc79921ad0551daaa134baecb1f81f6",
    "768e50efa6303a32043f7417f3360ffc3c9d4ba8",
    "4fc6247f63a71000a794758c3d266d42acd39758",
    "adfbec37138f84c212aab558a83e40570a349e1d",
    "b8725701da5bb62ed2371788edb05daa9b42799a",
    "10a0fe5f359d0f7bdcf10ed843b06a73338fa086",
    "a30f11be717bc710d4d6dbfa02da4767eec14fc1",
    "c0f1aba4346f0aca89f3ced0822af676a6835e87",
    "89399c4a03e038efb7a97fe38ab3f6604f1fc37e",
    "69ac5e45377465de71eed8a5527d7542130d8b2c",
    "69a5899a88ad3922168116e523a59a19f5fdbe63",
    "4da263905ead1900d957e11a24165aa5364da10c",
    "b3f980c9a1a5939c21865e1430cdb6514c9f0787",
    "195c2807c4b178c8d357d48560b759c70a5e1912",
    "f5527b7bdfa0eb61b5b399c8a92ef72bcaa1dca7",
    "60acf171a06b799678aa04c5ad2b999eba84f2e8",
    "c357c94e288185c8c29ec2af829d159d296d5907",
    "a7dc371d6a10326870be46b2cdf54803c4f05f2e",
    "1f5e0cc507a3f9749d8c6377663626bd31aaa99b",
    "8f352137a1e22f329086dd7b429049c7a8038718",
    "879c2e232949b8ec6c9ee6529ee39d5dbc502b8c",
    "aef44d7afe612259094ccd60494193225954bc51",
    "1fdadca3d067bcc8db56715a9a492dfd2d4f5b3d",
    "3b70d3d1cb0646f288537ed2695696c10b64d41b",
    "8188a5ccd6e88caaf801c0373283c18a0b315bf9",
    "75ebb8907480f01839e972a91051eccdd001619d",
    "0ec661c8aa7e106c4e03acbcca84c3cd8eaaea6d",
    "97da3e33e17f41d2187825d377bf0994c1631f89",
    "5f7c53e4006f76cbd1777b01005d03482d616f75",
    "50750f6ec4bdaa134369299de53d8d8b87d1ba63",
    "5f8f7e823d4e54b02610108a86ea721e337864ec",
    "d6cc685ba7b6ac3157adbb44c3f24c5a3c01ea67",
    "61e297c05feecd9901ec06b314429fe6ca92f27a",
    "d64a178d4759b796ec0e77626cf19257c28292fc",
    "6ae457f71b1cd60b1810fd4379c90bb38154568f",
    "063623280f208df296895ccd867dab8a73cf174d",
    "7a8b8c9aa0591603cf08e94ec2ae6a6350cbb8a2",
    "20c4232d3066c41e211eefe2834db78a8c083ea4",
    "82fdf2cccc77ab556aa35557d0923b162d1b98cf",
    "3dce8306f3c1810d5d81ed5ebb0ccea947277a61",
    "11bca5b61fc1f6d59078ec5354bc6d9adecc0c5d",
  ];

  for (var i = 0; i < expectedValues.length; i++) {
    var hash = new FastSha();
    hash.add(new List<int>.generate(i, (j) => j, growable: false));
    var digest = hash.close();
    expect(expectedValues[i], crypto.CryptoUtils.bytesToHex(digest));
  }
}

void _testInvalidUse() {
  var sha = new FastSha();
  sha.close();
  expect(() => sha.add([0]), throwsStateError);
}

void _testRepeatedDigest() {
  var sha = new FastSha();
  var digest = sha.close();
  expect(digest, sha.close());
}

void _testStandardVectors(inputs, mds) {
  for (var i = 0; i < inputs.length; i++) {
    var hash = new FastSha();
    hash.add(inputs[i]);
    var d = hash.close();
    expect(mds[i], crypto.CryptoUtils.bytesToHex(d), reason: '$i');
  }
}

// Standard test vectors from:
//   http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip

const sha1_short_inputs = const [
const [ ],
const [ 0x36 ],
const [ 0x19, 0x5a ],
const [ 0xdf, 0x4b, 0xd2 ],
const [ 0x54, 0x9e, 0x95, 0x9e ],
const [ 0xf7, 0xfb, 0x1b, 0xe2, 0x05 ],
const [ 0xc0, 0xe5, 0xab, 0xea, 0xea, 0x63 ],
const [ 0x63, 0xbf, 0xc1, 0xed, 0x7f, 0x78, 0xab ],
const [ 0x7e, 0x3d, 0x7b, 0x3e, 0xad, 0xa9, 0x88, 0x66 ],
const [ 0x9e, 0x61, 0xe5, 0x5d, 0x9e, 0xd3, 0x7b, 0x1c, 0x20 ],
const [ 0x97, 0x77, 0xcf, 0x90, 0xdd, 0x7c, 0x7e, 0x86, 0x35, 0x06 ],
const [ 0x4e, 0xb0, 0x8c, 0x9e, 0x68, 0x3c, 0x94, 0xbe, 0xa0, 0x0d, 0xfa ],
const [ 0x09, 0x38, 0xf2, 0xe2, 0xeb, 0xb6, 0x4f, 0x8a, 0xf8, 0xbb, 0xfc, 0x91 ],
const [ 0x74, 0xc9, 0x99, 0x6d, 0x14, 0xe8, 0x7d, 0x3e, 0x6c, 0xbe, 0xa7, 0x02, 0x9d ],
const [ 0x51, 0xdc, 0xa5, 0xc0, 0xf8, 0xe5, 0xd4, 0x95, 0x96, 0xf3, 0x2d, 0x3e, 0xb8, 0x74 ],
const [ 0x3a, 0x36, 0xea, 0x49, 0x68, 0x48, 0x20, 0xa2, 0xad, 0xc7, 0xfc, 0x41, 0x75, 0xba, 0x78 ],
const [ 0x35, 0x52, 0x69, 0x4c, 0xdf, 0x66, 0x3f, 0xd9, 0x4b, 0x22, 0x47, 0x47, 0xac, 0x40, 0x6a, 0xaf ],
const [ 0xf2, 0x16, 0xa1, 0xcb, 0xde, 0x24, 0x46, 0xb1, 0xed, 0xf4, 0x1e, 0x93, 0x48, 0x1d, 0x33, 0xe2, 0xed ],
const [ 0xa3, 0xcf, 0x71, 0x4b, 0xf1, 0x12, 0x64, 0x7e, 0x72, 0x7e, 0x8c, 0xfd, 0x46, 0x49, 0x9a, 0xcd, 0x35, 0xa6 ],
const [ 0x14, 0x8d, 0xe6, 0x40, 0xf3, 0xc1, 0x15, 0x91, 0xa6, 0xf8, 0xc5, 0xc4, 0x86, 0x32, 0xc5, 0xfb, 0x79, 0xd3, 0xb7 ],
const [ 0x63, 0xa3, 0xcc, 0x83, 0xfd, 0x1e, 0xc1, 0xb6, 0x68, 0x0e, 0x99, 0x74, 0xa0, 0x51, 0x4e, 0x1a, 0x9e, 0xce, 0xbb, 0x6a ],
const [ 0x87, 0x5a, 0x90, 0x90, 0x9a, 0x8a, 0xfc, 0x92, 0xfb, 0x70, 0x70, 0x04, 0x7e, 0x9d, 0x08, 0x1e, 0xc9, 0x2f, 0x3d, 0x08, 0xb8 ],
const [ 0x44, 0x4b, 0x25, 0xf9, 0xc9, 0x25, 0x9d, 0xc2, 0x17, 0x77, 0x2c, 0xc4, 0x47, 0x8c, 0x44, 0xb6, 0xfe, 0xff, 0x62, 0x35, 0x36, 0x73 ],
const [ 0x48, 0x73, 0x51, 0xc8, 0xa5, 0xf4, 0x40, 0xe4, 0xd0, 0x33, 0x86, 0x48, 0x3d, 0x5f, 0xe7, 0xbb, 0x66, 0x9d, 0x41, 0xad, 0xcb, 0xfd, 0xb7 ],
const [ 0x46, 0xb0, 0x61, 0xef, 0x13, 0x2b, 0x87, 0xf6, 0xd3, 0xb0, 0xee, 0x24, 0x62, 0xf6, 0x7d, 0x91, 0x09, 0x77, 0xda, 0x20, 0xae, 0xd1, 0x37, 0x05 ],
const [ 0x38, 0x42, 0xb6, 0x13, 0x7b, 0xb9, 0xd2, 0x7f, 0x3c, 0xa5, 0xba, 0xfe, 0x5b, 0xbb, 0x62, 0x85, 0x83, 0x44, 0xfe, 0x4b, 0xa5, 0xc4, 0x15, 0x89, 0xa5 ],
const [ 0x44, 0xd9, 0x1d, 0x3d, 0x46, 0x5a, 0x41, 0x11, 0x46, 0x2b, 0xa0, 0xc7, 0xec, 0x22, 0x3d, 0xa6, 0x73, 0x5f, 0x4f, 0x52, 0x00, 0x45, 0x3c, 0xf1, 0x32, 0xc3 ],
const [ 0xcc, 0xe7, 0x3f, 0x2e, 0xab, 0xcb, 0x52, 0xf7, 0x85, 0xd5, 0xa6, 0xdf, 0x63, 0xc0, 0xa1, 0x05, 0xf3, 0x4a, 0x91, 0xca, 0x23, 0x7f, 0xe5, 0x34, 0xee, 0x39, 0x9d ],
const [ 0x66, 0x4e, 0x6e, 0x79, 0x46, 0x83, 0x92, 0x03, 0x03, 0x7a, 0x65, 0xa1, 0x21, 0x74, 0xb2, 0x44, 0xde, 0x8c, 0xbc, 0x6e, 0xc3, 0xf5, 0x78, 0x96, 0x7a, 0x84, 0xf9, 0xce ],
const [ 0x95, 0x97, 0xf7, 0x14, 0xb2, 0xe4, 0x5e, 0x33, 0x99, 0xa7, 0xf0, 0x2a, 0xec, 0x44, 0x92, 0x1b, 0xd7, 0x8b, 0xe0, 0xfe, 0xfe, 0xe0, 0xc5, 0xe9, 0xb4, 0x99, 0x48, 0x8f, 0x6e ],
const [ 0x75, 0xc5, 0xad, 0x1f, 0x3c, 0xbd, 0x22, 0xe8, 0xa9, 0x5f, 0xc3, 0xb0, 0x89, 0x52, 0x67, 0x88, 0xfb, 0x4e, 0xbc, 0xee, 0xd3, 0xe7, 0xd4, 0x44, 0x3d, 0xa6, 0xe0, 0x81, 0xa3, 0x5e ],
const [ 0xdd, 0x24, 0x5b, 0xff, 0xe6, 0xa6, 0x38, 0x80, 0x66, 0x67, 0x76, 0x83, 0x60, 0xa9, 0x5d, 0x05, 0x74, 0xe1, 0xa0, 0xbd, 0x0d, 0x18, 0x32, 0x9f, 0xdb, 0x91, 0x5c, 0xa4, 0x84, 0xac, 0x0d ],
const [ 0x03, 0x21, 0x79, 0x4b, 0x73, 0x94, 0x18, 0xc2, 0x4e, 0x7c, 0x2e, 0x56, 0x52, 0x74, 0x79, 0x1c, 0x4b, 0xe7, 0x49, 0x75, 0x2a, 0xd2, 0x34, 0xed, 0x56, 0xcb, 0x0a, 0x63, 0x47, 0x43, 0x0c, 0x6b ],
const [ 0x4c, 0x3d, 0xcf, 0x95, 0xc2, 0xf0, 0xb5, 0x25, 0x8c, 0x65, 0x1f, 0xcd, 0x1d, 0x51, 0xbd, 0x10, 0x42, 0x5d, 0x62, 0x03, 0x06, 0x7d, 0x07, 0x48, 0xd3, 0x7d, 0x13, 0x40, 0xd9, 0xdd, 0xda, 0x7d, 0xb3 ],
const [ 0xb8, 0xd1, 0x25, 0x82, 0xd2, 0x5b, 0x45, 0x29, 0x0a, 0x6e, 0x1b, 0xb9, 0x5d, 0xa4, 0x29, 0xbe, 0xfc, 0xfd, 0xbf, 0x5b, 0x4d, 0xd4, 0x1c, 0xdf, 0x33, 0x11, 0xd6, 0x98, 0x8f, 0xa1, 0x7c, 0xec, 0x07, 0x23 ],
const [ 0x6f, 0xda, 0x97, 0x52, 0x7a, 0x66, 0x25, 0x52, 0xbe, 0x15, 0xef, 0xae, 0xba, 0x32, 0xa3, 0xae, 0xa4, 0xed, 0x44, 0x9a, 0xbb, 0x5c, 0x1e, 0xd8, 0xd9, 0xbf, 0xff, 0x54, 0x47, 0x08, 0xa4, 0x25, 0xd6, 0x9b, 0x72 ],
const [ 0x09, 0xfa, 0x27, 0x92, 0xac, 0xbb, 0x24, 0x17, 0xe8, 0xed, 0x26, 0x90, 0x41, 0xcc, 0x03, 0xc7, 0x70, 0x06, 0x46, 0x6e, 0x6e, 0x7a, 0xe0, 0x02, 0xcf, 0x3f, 0x1a, 0xf5, 0x51, 0xe8, 0xce, 0x0b, 0xb5, 0x06, 0xd7, 0x05 ],
const [ 0x5e, 0xfa, 0x29, 0x87, 0xda, 0x0b, 0xaf, 0x0a, 0x54, 0xd8, 0xd7, 0x28, 0x79, 0x2b, 0xcf, 0xa7, 0x07, 0xa1, 0x57, 0x98, 0xdc, 0x66, 0x74, 0x37, 0x54, 0x40, 0x69, 0x14, 0xd1, 0xcf, 0xe3, 0x70, 0x9b, 0x13, 0x74, 0xea, 0xeb ],
const [ 0x28, 0x36, 0xde, 0x99, 0xc0, 0xf6, 0x41, 0xcd, 0x55, 0xe8, 0x9f, 0x5a, 0xf7, 0x66, 0x38, 0x94, 0x7b, 0x82, 0x27, 0x37, 0x7e, 0xf8, 0x8b, 0xfb, 0xa6, 0x62, 0xe5, 0x68, 0x2b, 0xab, 0xc1, 0xec, 0x96, 0xc6, 0x99, 0x2b, 0xc9, 0xa0 ],
const [ 0x42, 0x14, 0x3a, 0x2b, 0x9e, 0x1d, 0x0b, 0x35, 0x4d, 0xf3, 0x26, 0x4d, 0x08, 0xf7, 0xb6, 0x02, 0xf5, 0x4a, 0xad, 0x92, 0x2a, 0x3d, 0x63, 0x00, 0x6d, 0x09, 0x7f, 0x68, 0x3d, 0xc1, 0x1b, 0x90, 0x17, 0x84, 0x23, 0xbf, 0xf2, 0xf7, 0xfe ],
const [ 0xeb, 0x60, 0xc2, 0x8a, 0xd8, 0xae, 0xda, 0x80, 0x7d, 0x69, 0xeb, 0xc8, 0x75, 0x52, 0x02, 0x4a, 0xd8, 0xac, 0xa6, 0x82, 0x04, 0xf1, 0xbc, 0xd2, 0x9d, 0xc5, 0xa8, 0x1d, 0xd2, 0x28, 0xb5, 0x91, 0xe2, 0xef, 0xb7, 0xc4, 0xdf, 0x75, 0xef, 0x03 ],
const [ 0x7d, 0xe4, 0xba, 0x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],
const [ 0x03, 0x21, 0x73, 0x6b, 0xeb, 0xa5, 0x78, 0xe9, 0x0a, 0xbc, 0x1a, 0x90, 0xaa, 0x56, 0x15, 0x7d, 0x87, 0x16, 0x18, 0xf6, 0xde, 0x0d, 0x76, 0x4c, 0xc8, 0xc9, 0x1e, 0x06, 0xc6, 0x8e, 0xcd, 0x3b, 0x9d, 0xe3, 0x82, 0x40, 0x64, 0x50, 0x33, 0x84, 0xdb, 0x67, 0xbe, 0xb7, 0xfe, 0x01, 0x22, 0x32, 0xda, 0xca, 0xef, 0x93, 0xa0, 0x00, 0xfb, 0xa7 ],
const [ 0xd0, 0xa2, 0x49, 0xa9, 0x7b, 0x5f, 0x14, 0x86, 0x72, 0x1a, 0x50, 0xd4, 0xc4, 0xab, 0x3f, 0x5d, 0x67, 0x4a, 0x0e, 0x29, 0x92, 0x5d, 0x5b, 0xf2, 0x67, 0x8e, 0xf6, 0xd8, 0xd5, 0x21, 0xe4, 0x56, 0xbd, 0x84, 0xaa, 0x75, 0x53, 0x28, 0xc8, 0x3f, 0xc8, 0x90, 0x83, 0x77, 0x26, 0xa8, 0xe7, 0x87, 0x7b, 0x57, 0x0d, 0xba, 0x39, 0x57, 0x9a, 0xab, 0xdd ],
const [ 0xc3, 0x21, 0x38, 0x53, 0x11, 0x18, 0xf0, 0x8c, 0x7d, 0xcc, 0x29, 0x24, 0x28, 0xad, 0x20, 0xb4, 0x5a, 0xb2, 0x7d, 0x95, 0x17, 0xa1, 0x84, 0x45, 0xf3, 0x8b, 0x8f, 0x0c, 0x27, 0x95, 0xbc, 0xdf, 0xe3, 0xff, 0xe3, 0x84, 0xe6, 0x5e, 0xcb, 0xf7, 0x4d, 0x2c, 0x9d, 0x0d, 0xa8, 0x83, 0x98, 0x57, 0x53, 0x26, 0x07, 0x49, 0x04, 0xc1, 0x70, 0x9b, 0xa0, 0x72 ],
const [ 0xb0, 0xf4, 0xcf, 0xb9, 0x39, 0xea, 0x78, 0x5e, 0xab, 0xb7, 0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, 0x31, 0x39, 0xba, 0x96, 0x56, 0xcd, 0x35, 0xc1, 0x42, 0x01, 0xf1, 0xc7, 0xc6, 0xf0, 0xee, 0xb5, 0x8d, 0x2d, 0xbf, 0xe3, 0x5b, 0xfd, 0xec, 0xcc, 0x92, 0xc3, 0x96, 0x1c, 0xfa, 0xbb, 0x59, 0x0b, 0xc1, 0xeb, 0x77, 0xea, 0xc1, 0x57, 0x32, 0xfb, 0x02, 0x75, 0x79, 0x86, 0x80, 0xe0, 0xc7, 0x29, 0x2e, 0x50 ],
const [ 0xf2, 0xc7, 0x6e, 0xf6, 0x17, 0xfa, 0x2b, 0xfc, 0x8a, 0x4d, 0x6b, 0xcb, 0xb1, 0x5f, 0xe8, 0x84, 0x36, 0xfd, 0xc2, 0x16, 0x5d, 0x30, 0x74, 0x62, 0x95, 0x79, 0x07, 0x9d, 0x4d, 0x5b, 0x86, 0xf5, 0x08, 0x1a, 0xb1, 0x77, 0xb4, 0xc3, 0xf5, 0x30, 0x37, 0x6c, 0x9c, 0x92, 0x4c, 0xbd, 0x42, 0x1a, 0x8d, 0xaf, 0x88, 0x30, 0xd0, 0x94, 0x0c, 0x4f, 0xb7, 0x58, 0x98, 0x65, 0x83, 0x06, 0x99 ],
const [ 0x45, 0x92, 0x7e, 0x32, 0xdd, 0xf8, 0x01, 0xca, 0xf3, 0x5e, 0x18, 0xe7, 0xb5, 0x07, 0x8b, 0x7f, 0x54, 0x35, 0x27, 0x82, 0x12, 0xec, 0x6b, 0xb9, 0x9d, 0xf8, 0x84, 0xf4, 0x9b, 0x32, 0x7c, 0x64, 0x86, 0xfe, 0xae, 0x46, 0xba, 0x18, 0x7d, 0xc1, 0xcc, 0x91, 0x45, 0x12, 0x1e, 0x14, 0x92, 0xe6, 0xb0, 0x6e, 0x90, 0x07, 0x39, 0x4d, 0xc3, 0x3b, 0x77, 0x48, 0xf8, 0x6a, 0xc3, 0x20, 0x7c, 0xfe ],
];

const sha1_short_mds = const [
'da39a3ee5e6b4b0d3255bfef95601890afd80709',
'c1dfd96eea8cc2b62785275bca38ac261256e278',
'0a1c2d555bbe431ad6288af5a54f93e0449c9232',
'bf36ed5d74727dfd5d7854ec6b1d49468d8ee8aa',
'b78bae6d14338ffccfd5d5b5674a275f6ef9c717',
'60b7d5bb560a1acf6fa45721bd0abb419a841a89',
'a6d338459780c08363090fd8fc7d28dc80e8e01f',
'860328d80509500c1783169ebf0ba0c4b94da5e5',
'24a2c34b976305277ce58c2f42d5092031572520',
'411ccee1f6e3677df12698411eb09d3ff580af97',
'05c915b5ed4e4c4afffc202961f3174371e90b5c',
'af320b42d7785ca6c8dd220463be23a2d2cb5afc',
'9f4e66b6ceea40dcf4b9166c28f1c88474141da9',
'e6c4363c0852951991057f40de27ec0890466f01',
'046a7b396c01379a684a894558779b07d8c7da20',
'd58a262ee7b6577c07228e71ae9b3e04c8abcda9',
'a150de927454202d94e656de4c7c0ca691de955d',
'35a4b39fef560e7ea61246676e1b7e13d587be30',
'7ce69b1acdce52ea7dbd382531fa1a83df13cae7',
'b47be2c64124fa9a124a887af9551a74354ca411',
'8bb8c0d815a9c68a1d2910f39d942603d807fbcc',
'b486f87fb833ebf0328393128646a6f6e660fcb1',
'76159368f99dece30aadcfb9b7b41dab33688858',
'dbc1cb575ce6aeb9dc4ebf0f843ba8aeb1451e89',
'd7a98289679005eb930ab75efd8f650f991ee952',
'fda26fa9b4874ab701ed0bb64d134f89b9c4cc50',
'c2ff7ccde143c8f0601f6974b1903eb8d5741b6e',
'643c9dc20a929608f6caa9709d843ca6fa7a76f4',
'509ef787343d5b5a269229b961b96241864a3d74',
'b61ce538f1a1e6c90432b233d7af5b6524ebfbe3',
'5b7b94076b2fc20d6adb82479e6b28d07c902b75',
'6066db99fc358952cf7fb0ec4d89cb0158ed91d7',
'b89962c94d60f6a332fd60f6f07d4f032a586b76',
'17bda899c13d35413d2546212bcd8a93ceb0657b',
'badcdd53fdc144b8bf2cc1e64d10f676eebe66ed',
'01b4646180f1f6d2e06bbe22c20e50030322673a',
'10016dc3a2719f9034ffcc689426d28292c42fc9',
'9f42fa2bce6ef021d93c6b2d902273797e426535',
'cdf48bacbff6f6152515323f9b43a286e0cb8113',
'b88fb75274b9b0fd57c0045988cfcef6c3ce6554',
'c06d3a6a12d9e8db62e8cff40ca23820d61d8aa7',
'6e40f9e83a4be93874bc97cdebb8da6889ae2c7a',
'3efc940c312ef0dfd4e1143812248db89542f6a5',
'a0cf03f7badd0c3c3c4ea3717f5a4fb7e67b2e56',
'a544e06f1a07ceb175a51d6d9c0111b3e15e9859',
'199d986ed991b99a071f450c6b1121a727e8c735',
'33bac6104b0ad6128d091b5d5e2999099c9f05de',
'76d7db6e18c1f4ae225ce8ccc93c8f9a0dfeb969',
'f652f3b1549f16710c7402895911e2b86a9b2aee',
'63faebb807f32be708cf00fc35519991dc4e7f68',
'0e6730bc4a0e9322ea205f4edfff1fffda26af0a',
'b61a3a6f42e8e6604b93196c43c9e84d5359e6fe',
'32d979ca1b3ed0ed8c890d99ec6dd85e6c16abf4',
'6f18190bd2d02fc93bce64756575cea36d08b1c3',
'68f525feea1d8dbe0117e417ca46708d18d7629a',
'a7272e2308622ff7a339460adc61efd0ea8dabdc',
'aef843b86916c16f66c84d83a6005d23fd005c9e',
'be2cd6f380969be59cde2dff5e848a44e7880bd6',
'e5eb4543deee8f6a5287845af8b593a95a9749a1',
'534c850448dd486787b62bdec2d4a0b140a1b170',
'6fbfa6e4edce4cc85a845bf0d228dc39acefc2fa',
'018872691d9b04e8220e09187df5bc5fa6257cd9',
'd98d512a35572f8bd20de62e9510cc21145c5bf4',
'9f3ea255f6af95c5454e55d7354cabb45352ea0b',
'a70cfbfe7563dd0e665c7c6715a96a8d756950c0',
];
